package hikari.preferences.device_parameters;

import org.swig.jirr.E_DRIVER_TYPE;

/**
 * @author sad
 */
public class DriverType {

    private String name;
    private E_DRIVER_TYPE driverType;

    public static DriverType create(E_DRIVER_TYPE driver) {
        for(DriverType d:getDriverTypes()){
            if(d.driverType==driver){
                return d;
            }
        }
        return null;
    }
    
    public DriverType(String name, E_DRIVER_TYPE driverType) {
        this.name = name;
        this.driverType = driverType;
    }
    
    /**
     * C++ value of this enum
     * @return 
     */
    public long getDriverType(){
        return driverType.swigValue();
    }

    @Override
    public String toString() {
        return name;
    }

    public static DriverType[] getDriverTypes() {
        DriverType[] types = new DriverType[]{
            new DriverType("NULL", E_DRIVER_TYPE.EDT_NULL),
            new DriverType("Software", E_DRIVER_TYPE.EDT_SOFTWARE),
            new DriverType("BurningsVideo", E_DRIVER_TYPE.EDT_BURNINGSVIDEO),
            new DriverType("OpenGL", E_DRIVER_TYPE.EDT_OPENGL),
            new DriverType("Direct3d 8", E_DRIVER_TYPE.EDT_DIRECT3D8),
            new DriverType("Direct3d 9", E_DRIVER_TYPE.EDT_DIRECT3D9),};
        return types;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 79 * hash + (this.driverType != null ? this.driverType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DriverType other = (DriverType) obj;
        if (this.driverType != other.driverType) {
            return false;
        }
        return true;
    }
}
